<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="keywords" content="jquery,ui,easy,easyui,web">
	<meta name="description" content="biblioteca!">
	<title>ALTAS DE LIBROS</title>
	<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
	<style type="text/css">
		#fm{
			margin:0;
			padding:10px 30px;
		}
		.ftitle{
	font-size:24px;
	font-weight:bold;
	color:#666;
	padding:5px 0;
	margin-bottom:10px;
	border-bottom:1px solid #ccc;
	background-image: url(iconos.jpg);
	background-repeat: no-repeat;
	background-position: center center;
		}
		.fitem{
			margin-bottom:5px;
		}
		.fitem label{
			display:inline-block;
			width:80px;
		}
	.Estilo1 {font-size: x-large}
    .Estilo2 {
	font-size: xx-large;
	font-family: Algerian;
}
    .Estilo6 {color: #FFFFFF;
	font-family: Algerian;
	font-size: xx-large;
}
    .Estilo7 {font-size: xx-large}
    </style>
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
	<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript">
	
	
		var url;
		function newUser(){
			$('#dlg').dialog('open').dialog('setTitle','New User');
			$('#fm').form('clear');
			url = 'save_alumno.php';
		}
		
		
		function editUser(){
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$('#dlg').dialog('open').dialog('setTitle','Edit User');
				$('#fm').form('load',row);
				url = 'update_alumno.php?id_alumno='+row.id_alumno;
			}
		}
		function saveUser(){
			$('#fm').form('submit',{
				url: url,
				onSubmit: function(){
					return $(this).form('validate');
				},
				success: function(result){
					var result = eval('('+result+')');
					if (result.success){
						$('#dlg').dialog('close');		// close the dialog
						$('#dg').datagrid('reload');	// reload the user data
					} else {
						$.messager.show({
							title: 'Error',
							msg: result.msg
						});
					}
				}
			});
		}
		function removeUser(){
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$.messager.confirm('Confirm','¿Está seguro que desea eliminar el libro?',function(r){
					if (r){
						$.post('remove_alumnos.php',{id:row.id},function(result){
							if (result.success){
								$('#dg').datagrid('reload');	// reload the user data
							} else {
								$.messager.show({	// show error message
									title: 'Error',
									msg: result.msg
								});
							}
						},'json');
					}
				});
			}
		}
	</script>
</head>
<body>
	<h2 align="center" style="margin-bottom: 10px">&nbsp;</h2>
	<table width="1069" height="103" border="1">
      <tr bgcolor="#000000">
        <th width="1059" scope="col"><span class="Estilo6">EMPRESA DMG</span></th>
      </tr>
</table>
	<h2 align="center" style="margin-bottom: 10px"><img src="iconos2.jpg" alt="foto" width="1076" height="138" longdesc="../../../../Users/chuyita/Documents/CRUD/index.php"></h2>
	<div class="demo-info" style="margin-bottom:10px">
	  <div></div>
</div>
	
	<p align="center"><span class="Estilo2">BIBLIOTECA</span></p>
	<p align="center"><img src="iconos.jpg" alt="FOTO" width="275" height="183" longdesc="../../../../Users/chuyita/Documents/CRUD/index.php"></p>
	<p>&nbsp;</p>
	<div align="center"></div>
	 <table width="1023" height="261" bordercolor="#006699" class="easyui-datagrid" id="dg" style="width:700px;height:250px" title=""
			url="get_alumnos.php"
			toolbar="#toolbar" pagination="true"
			rownumbers="true" fitcolumns="true" singleselect="true">
       <thead>
         <tr align="center" valign="middle">
         
           <th width="50" field="nombre"><div align="center">Nombre</div></th>
           <th width="50" field="matricula"><div align="center">Matricula</div></th>
           <th width="50" field="direccion"><div align="center">Direccion</div></th>
         </tr>
       </thead>
     </table>
     <div id="toolbar">
		<div align="center">
		  <p class="Estilo1"><a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onClick="newUser()">Nuevo Alumno</a>
	        <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onClick="editUser()">Editar Alumno</a>
          <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onClick="removeUser()">Eliminar Alumno</a> </p>
	    </div>
	</div>
	
	<div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"
			closed="true" buttons="#dlg-buttons">
		<div class="ftitle">
		  <div align="center">Altas</div>
		</div>
		<form id="fm" method="post" novalidate>
			<div class="fitem">
				<label>Nombre de Alumno:</label>
				<input name="nombre" class="easyui-validatebox" required="true">
			</div>
			<div class="fitem">
				<label>Matricula:</label>
				<input name="matricula" class="easyui-validatebox" required="true">
			</div>
			<div class="fitem">
				<label>Direccion:</label>
				<input name="direccion">
			</div>
		
            
            
            
            
            
            
		</form>
	</div>
	<div id="dlg-buttons">
		<div align="center"><a href="#" class="easyui-linkbutton" iconCls="icon-ok" onClick="saveUser()">guardar </a>
		  <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onClick="javascript:$('#dlg').dialog('close')">Cancelar</a>
	  </div>
	</div>
    <p align="center"><a href="imprimir.php" class="Estilo7">Imprimir</a></p>
        <p align="center"><a href="registros.php" class="Estilo7">Adquilar Libro</a></p>
    
</body>
</html>